/*
 * Copyright @ 2025 weili23
 * com.example.ai.config 18:15
 * All right reserved.
 */

package com.example.ai.config;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @desc:配置自己的模型
 * @author: weili23
 * @createTime: 2025/4/30 18:15
 * @version: v1.0
 */
@Configuration
public class Langchain4jChatModelConfig {
    @Autowired
    private OpenAiConfigProperties openAiConfigProperties;
    @Bean
    public ChatLanguageModel openAiChatLanguageModel() {
        return OpenAiChatModel.builder()
                .baseUrl(openAiConfigProperties.getBaseUrl())
                .apiKey(openAiConfigProperties.getApiKey()) // 替换为你的 API Key
                .modelName(openAiConfigProperties.getModelName())
                .build();
    }
}
